<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>编辑公司信息</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="${pageContext.request.contextPath}/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/css/animate.min.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/css/style.min.css?v=4.1.0" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/css/bootstrap-fileinput/fileinput.min.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/jQuery-Validation/css/validationEngine.jquery.css" rel="stylesheet">
    <style type="text/css">
        .formErrorContent{
            color: red;
        }
    </style>
</head>

<body class="gray-bg">
<div class="formErrorContent"></div>
    <div class="container" style="margin-top: 20px">
        <form class="form-horizontal" role="form" id="testUploadFrom" enctype="multipart/form-data" method="post" autocomplete="off">
                <div class="form-group">
                	<label class="col-sm-4 control-label">手持身份证照片:</label>
                	<div class="col-sm-4">
                        <input type="file" class="file-loading" data-ref="handIdCard" name="hc"
                        	id="hand" placeholder="手持身份证"><input type="text" name="handIdCard">
                    </div>
                </div>
                <div class="form-group">
                	<label class="col-sm-4 control-label">手持身份证照片:</label>
                	<div class="col-sm-4">
                        <input type="file" class="file-loading" data-ref="doorheader" name="dh"
                        	id="door" placeholder="手持身份证"><input type="text" name="doorheader">
                    </div>
                </div>
                <div class="form-group" style="margin-left: 150px;margin-top: 50px">
                    <div class="col-sm-6 control-label">
                        <button type="button" class="btn btn-default" onclick="closeForm();">关闭</button>
                        &nbsp;&nbsp;&nbsp;&nbsp;<button type="button" class="btn btn-primary"  id="save" >保存</button>
                    </div>
                </div>
        </form>
    </div>
<script src="${pageContext.request.contextPath}/js/jquery.min.js?v=2.1.4"></script>
<script src="${pageContext.request.contextPath}/js/bootstrap.min.js?v=3.3.6"></script>
<script src="${pageContext.request.contextPath}/js/content.min.js?v=1.0.0"></script>
<script src="${pageContext.request.contextPath}/js/plugins/layer/layer.min.js"></script>
<script src="${pageContext.request.contextPath}/js/public/ttbj-core.js"></script>
<script src="${pageContext.request.contextPath}/js/bootstrap-fileinput/fileinput.min.js"></script>
<script src="${pageContext.request.contextPath}/js/bootstrap-fileinput/zh.js"></script>
<script type="text/javascript">
$(function () {
    var path = "../company/imageUpload.htm";
    //初始化上传图片组件
    initFileInput("hand", path);
    initFileInput("door", path);
});


//上传图片组件
function initFileInput(ctrlName, uploadUrl){
	var control = $('#' + ctrlName);
	console.log(uploadUrl);
	control.fileinput({
		uploadUrl: uploadUrl,	//上传地址
		uploadAsync : true, //默认异步上传
		showUpload : false, //是否显示上传按钮,跟随文本框的那个
		showRemove : false, //显示移除按钮,跟随文本框的那个
		showCaption : true,//是否显示标题,就是那个文本框
		showPreview : true, //是否显示预览,不写默认为true
		dropZoneEnabled : false,//是否显示拖拽区域，默认不写为true，但是会占用很大区域
		maxFileCount : 1, //表示允许同时上传的最大文件个数
		enctype : 'multipart/form-data',
		validateInitialCount : true,
		previewFileIcon : "<i class='glyphicon glyphicon-king'></i>",
		msgFilesTooMany : "选择上传的文件数量({n}) 超过允许的最大数值{m}！",
		allowedFileTypes : [ 'image' ],//配置允许文件上传的类型
		allowedPreviewTypes : [ 'image' ],//配置所有的被预览文件类型
		allowedPreviewMimeTypes : [ 'jpg', 'png', 'gif','jpeg' ],//控制被预览的所有mime类型
		language : 'zh' 
	}).on("filepreupload", function(event, data, previewId, index){				//上传前
		 
	}).on("fileuploaded", function(event, data, previewId, index){	 //上传图片后的回调函数，可以在这做一些处理
		console.log(data.response.data);
		var ref = $(this).attr("data-ref");
		$("input[name='" + ref + "']").val(data.response.data);
	});
}
</script>
</body>

</html>